package sk.stuba.fiit.arthur.web.mvc.model.service;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;

import sk.stuba.fiit.arthur.web.mvc.model.dao.PersonDao;
import sk.stuba.fiit.arthur.web.mvc.model.entity.PersonEntity;

@Service("PersonService")
public class PersonServiceImpl implements PersonService {

	@Autowired()
	private PersonDao personDao;
	
	public Collection<PersonEntity> findPersons() {
		return personDao.findPersons();
	}

	@Secured ({"ROLE_ADMIN"})
	public void delete(PersonEntity personEntity) {
		personDao.delete(personEntity);	
	}
	
	public void save(PersonEntity personEntity){
		personDao.save(personEntity);
	}
	
	public PersonEntity findPersonById(Integer id) {
		return personDao.findPersonById(id);
	}
}
